package com.code.leetcode.offer;

import jdk.nashorn.internal.ir.IfNode;

/**
 * @author codeDorado
 * @version 1.0
 * @date 2020/8/2 21:24
 */
public class The46_dp {
    public int translateNum(int num) {
        String str = String.valueOf(num);
        int[] dp = new int[str.length() + 1];
        dp[0] = 1;
        dp[1] = 1;
        for (int i = 2; i <= str.length(); i++) {
            dp[i] = dp[i - 1] +
                    (check(str.charAt(i - 2), str.charAt(i - 1)) ? dp[i - 2] : 0);
        }
        return dp[str.length()];
    }

    public boolean check(char n, char c) {
        return  !(n > '2' || (n == '2' && c > '5') || n < '1');
    }

    public static void main(String[] args) {
        System.out.println('z' - 25);
    }
}
